#!/bin/bash

UT_LOG_FILE=ut_result.xml
UT_EXE_FILE_NAME=lcd_app_frame_work_unit_test

InitUTEnv()
{
	PATH_LIB_LIST=`find ./ -name "lib"`;
	for PATH_LIB in ${PATH_LIB_LIST}
	do
		LD_LIBRARY_PATH=${PATH_LIB}:${LD_LIBRARY_PATH};
	done	
}

RunUT()
{
	chmod u+x ${UT_EXE_FILE_NAME};
	./${UT_EXE_FILE_NAME} --gtest_output=xml:${UT_LOG_FILE};
	return $?;
}

if [ $# -lt 1 ]
then
	echo -e "Useage:$0  ut_log_file_name\nExample:\n\t$0 /root/ut_result_log.xml\n";
#	exit 1;
	UT_LOG_FILE="ut_result_log.xml"
else
	UT_LOG_FILE=$1;
fi
rm -f ${UT_LOG_FILE};
InitUTEnv;
RunUT;
exit $?;

